package com.fenjiangfan.growth.system.common.exception;

import com.fenjiangfan.growth.system.common.errorcode.BaseErrorcode;
import com.fenjiangfan.growth.system.common.errorcode.IErrorCode;

/**
 * 服务端运行异常
 */
public class ServiceException extends AbsractException {

    public ServiceException(IErrorCode errorCode) {
        this(errorCode, errorCode.message(), null);
    }

    public ServiceException(String errorMessage) {
        this(BaseErrorcode.SERVICE_ERROR, errorMessage, null);
    }

    public ServiceException(IErrorCode errorCode, String errorMessage) {
        this(errorCode, errorMessage, null);
    }


    public ServiceException(IErrorCode errorCode, String errorMessage, Throwable throwable) {
        super(errorCode, errorMessage, throwable);
    }

    @Override
    public String toString() {
        return "ServiceException{" +
                "code='" + errorCode + "'," +
                "message='" + errorMessage + "'" +
                '}';
    }
}
